﻿using IS_Ever_Green.DataAccess.Model.Repositories;
using IS_Ever_Green.DataAccess.Model;
using System.Collections.ObjectModel;
using System.Windows.Input;

namespace IS_Ever_Green.ViewModel
{
    public class AccessoriesViewModel : BaseViewModel
    {
        private IProductRepository _productRepository;
        private ObservableCollection<ProductModel> _accessoriesList;
        private string _textAccessories;

        public ObservableCollection<ProductModel> AccessoriesList
        {
            get { return _accessoriesList; }
            set { _accessoriesList = value; OnPropertyChanged(nameof(AccessoriesList)); }
        }       

        public string TextAccessories
        {
            get { return _textAccessories; }
            set { _textAccessories = value; OnPropertyChanged(nameof(TextAccessories)); }
        }


        public ICommand AddProductCart { get; }
        public ICommand AddProductLike { get; }
        public ICommand DeleteProductCart { get; }
        public ICommand DeleteProductLike { get; }

        public AccessoriesViewModel()
        {
            _productRepository = new ProductRepository();

            ShowProductFromAccessories();
        }

        public void ShowProductFromAccessories()
        {
            AccessoriesList = new ObservableCollection<ProductModel>(_productRepository.GetProductWithCategory(2));
            if (AccessoriesList.Count != 0)
            {
                TextAccessories = "Комплектующие";
            }
        }
    }
}
